import { useState } from 'react';

export default function useThemeModel() {
  // 从 localStorage 获取保存的主题颜色，默认使用 Ant Design 的蓝色
  const [themeColor, setThemeColor] = useState(() => {
    const savedColor = localStorage.getItem('theme-color');
    return savedColor || '#1890ff';
  });

  // 更新主题颜色并保存到 localStorage
  const updateTheme = (color: string) => {
    setThemeColor(color);
    localStorage.setItem('theme-color', color);
  };

  return {
    themeColor,
    updateTheme
  };
}